package tjs.study.notes.dotest.jdk.子父类同属性;

/**
 * Created by Nicky.Tang on 2022/12/5 上午10:10
 *
 * @since 02.12.10
 */
public class 子父类同属性 {
    public static void main(String[] args) {
        Son1 son1 = new Son1();
        son1.setName("aaa");
        System.out.println("son1：" + son1.getName() + "; ft：" + ((Father) son1).getName() + "; ftStatic：" + getName(son1));
        Son2 son2 = new Son2();
        son2.setName("aaa");
        System.out.println("son2：" + son2.getName() + "; ft：" + ((Father) son2).getName() + "; ftStatic：" + getName(son2));
        Son3 son3 = new Son3();
        son3.setName("aaa");
        System.out.println("son3：" + son3.getName() + "; ft：" + ((Father) son3).getName() + "; ftStatic：" + getName(son3));
        Son4 son4 = new Son4();
        son4.setName("aaa");
        System.out.println("son4：" + son4.getName() + "; ft：" + ((Father) son4).getName() + "; ftStatic：" + getName(son4));
    }

    public static String getName(Father father) {
        father.setName(father.getName() + "bbb");
        return father.getName();
    }


}
